<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<link rel="stylesheet" type="text/css" href="../css/bootstrap.min.css"/>
		 <script type="text/javascript" src="../js/jquery.min.js">
		 	
		 </script>	
		<title>登录页面</title>
	</head>
	<body>
		<div id="" class="container" style="width: 300px; margin-top: 50px;">
			<fieldset id="">
				<legend>登录</legend>
				<div id=""  class="form-group">
					<label for="username">用户名:</label>
					<input class="form-control" autocomplete="off" type="text" name="username" id="username"  value="" />
				</div>
				<div id="" class="form-group">
					<label for="password">密码</label>
					<input class="form-control" autocomplete="off" type="password" name="password" id="password" value="" />
				</div>
				<div id="" class="form-group">
					<!-- 
					   onclick-----单击触发事件---单击触发里面的函数
					   save()/clear() :js中自定义的函数
					 -->
					<!-- <button type="button" onclick="save()"   class="btn btn-primary">保存</button>
					<button type="button" onclick="mclear()"  class="btn btn-danger">取消</button> -->
				
				<button type="button" id="save"  class="btn btn-primary">保存</button>
				<button type="button" id="clear"  class="btn btn-danger">取消</button>
				</div>
			</fieldset>
		</div>
	</body>
	<script type="text/javascript">
	/* 	function save(){
			let username = document.getElementById("username");
			console.log(username.value);
			let password = document.getElementById("password");
			console.log(password.value);
		} */
		function save(){
			console.log($("#username").val());
			console.log($("#password").val());
		}
		// clear可能被新的标准征用-------命名时注意与关键字重名
		/* function mclear(){
			document.getElementById("username").value='';
			document.getElementById("password").value='';
		} */
		function mclear(){
			console.log($("#username").val(''));
			console.log($("#password").val(''));
			
		}
		
		$("#save").click(function(){
			var username = $("#username").val();
			var password = $("#password").val();
			console.log(username+","+password);
		})
		$("#clear").click(function(){
			$("#password").val('');
			$("#username").val('');
			console.log(username+","+password);
		})
	</script>
</html>
